using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;
namespace MicroMsg.Storage
{
	[Table]
	public class SnsPage : StorageItem
	{
		[Column(IsPrimaryKey = true)]
		public string strUserName;
		[Column]
		public string strFirstPageMd5;
		[Column]
		public int nObjectTotal;
		[Column(DbType = "Image")]
		public byte[] bytesObjIDRegionList;
		[Column(IsVersion = true)]
		private Binary _version;
		private SnsRegionInfo _regionInfo;
		public SnsRegionInfo regionInfo
		{
			get
			{
				if (this._regionInfo != null)
				{
					return this._regionInfo;
				}
				this._regionInfo = StorageXml.loadFromBuffer<SnsRegionInfo>(this.bytesObjIDRegionList);
				if (this._regionInfo == null)
				{
					this._regionInfo = new SnsRegionInfo();
				}
				return this._regionInfo;
			}
			set
			{
				this._regionInfo = value;
				this.regionsInfoFlush();
			}
		}
		public void regionsInfoFlush()
		{
			if (this._regionInfo != null && this._regionInfo.regions.get_Count() > 0)
			{
				this.bytesObjIDRegionList = StorageXml.saveToBuffer<SnsRegionInfo>(this._regionInfo);
				return;
			}
			this.bytesObjIDRegionList = null;
		}
	}
}
